package com.ttxz.common.utils.log

import androidx.annotation.NonNull
import androidx.annotation.Nullable
import com.orhanobut.logger.Logger

/**
 * 日志工具类
 */
object LogUtil {
    fun d(@NonNull message: String, @Nullable vararg args: Any) {
        Logger.d(message, *args)
    }

    fun d(@Nullable obj: Any) {
        Logger.d(obj)
    }

    fun e(@NonNull message: String, @Nullable vararg args: Any) {
        Logger.e(message, *args)
    }

    fun e(@Nullable throwable: Throwable?, @NonNull message: String, @Nullable vararg args: Any) {
        Logger.e(throwable, message, *args)
    }

    fun i(@NonNull message: String, @Nullable vararg args: Any) {
        Logger.i(message, *args)
    }

    fun v(@NonNull message: String, @Nullable vararg args: Any) {
        Logger.v(message, *args)
    }

    fun w(@NonNull message: String, @Nullable vararg args: Any) {
        Logger.w(message, *args)
    }

    /**
     * Tip: Use this for exceptional situations to log
     * ie: Unexpected errors etc
     */
    fun wtf(@NonNull message: String, @Nullable vararg args: Any) {
        Logger.wtf(message, *args)
    }

    /**
     * Formats the given json content and print it
     */
    fun json(@Nullable json: String?) {
        Logger.json(json)
    }

    /**
     * Formats the given xml content and print it
     */
    fun xml(@Nullable xml: String) {
        Logger.xml(xml)
    }

}